package lelouet.datacenter.simulation.events;

import java.util.List;

import lelouet.datacenter.simulation.Event;
import lelouet.datacenter.simulation.EventHandler;
import lelouet.datacenter.simulation.PhysicalRequirements;
import lelouet.datacenter.simulation.VM;
import lelouet.datacenter.simulation.vms.AVM;

public class VMSpecChange extends VMEvent {

	public VMSpecChange(VM vm, long time, PhysicalRequirements before,
			PhysicalRequirements after) {
		super(vm, time);
		this.before = before;
		this.after = after;
	}

	/** the former specs of the VM */
	public final PhysicalRequirements before, after;

	@Override
	public List<Event> apply(EventHandler handler) {
		return handler.handleSpecChange(this);
	}

	@Override
	public String toString() {
		return "VM <" + vm.getId() + "> changed specs from <"
				+ AVM.showSpecs(before) + "> to <" + AVM.showSpecs(vm) + ">";
	}

}
